package com.yx.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.yx.data.Result;
import com.yx.entity.SysLog;
import com.yx.mapper.SysLogMapper;
import com.yx.page.Page;
import com.yx.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * @Description: 日志
 * @Auther: zcz
 * @create 2020/4/16 11:51
 */
@Service
@Transactional(rollbackFor = { RuntimeException.class, Exception.class })
public class SysLogServiceImpl implements SysLogService {

    @Autowired
    private SysLogMapper sysLogMapper;


    @Override
    public Result insert(SysLog sysLog) {
        return null;
    }

    @Override
    public Result update(SysLog sysLog) {
        return null;
    }

    @Override
    public Result delete(String id) {
        int i = sysLogMapper.delete(id);
        return Result.ok();
    }

    @Override
    public Result getList(Page page, SysLog sysLog) {
        //只有紧跟在PageHelper.startPage方法后的第一个Mybatis的查询（Select）方法会被分页。
        PageHelper.startPage(page.getPageNum(), page.getPageSize());
        List<SysLog> list = sysLogMapper.getList(sysLog);
        PageInfo<SysLog> pageInfo = new PageInfo<>(list);
        return Result.data(pageInfo) ;
    }

    @Override
    public Result getInfo(String id) {
        return null;
    }

}
